package threadMethod;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.TimeUnit;

/**
 * @author： pang-yun
 * @date： 2021-10-14 19:26
 * 功能目的 ：用于  模拟线程休眠
 */
@Slf4j
public class SleepTest{
    public static void main(String[] args) {
    Runnable r=()-> {
        try {
            long l = System.currentTimeMillis();
            TimeUnit.SECONDS.sleep(1);
            long a =System.currentTimeMillis()-l;
            System.out.println(a);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    };

        Thread pang = new Thread(r, "pang");
        pang.start();
        pang.setDaemon(false);
        pang.setPriority(Thread.MAX_PRIORITY);

    }


}
